package com.job.Yangmingyu.String0716;


import java.util.Scanner;

/**
 * @author Yangmingyu
 * @version 1.0
 * @since 2022-07-17 10:08:55
 */
public class CharCount {
    public static void main(String[] args) {
        Character code = null;
        Integer count = null;
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        count(s,code,count);
    }
    public static void count(String s,Character code,Integer count){
        String sbf= new String(s);
        char[] ch=new char[sbf.length()];
        ch=sbf.toCharArray();
        char[] arr=new char[sbf.length()];
        int[] num=new int[sbf.length()];
        count=0;
        int l=0;
        for (int i=0;i<sbf.length();i++){
            char a=sbf.charAt(i);
            if (Character.isUpperCase(a)){
                code=a;
                arr[l]=a;
                for (int k=0;k<sbf.length();k++){
                    if (ch[k]==arr[i]){
                        count++;
                        ch[k]=' ';
                    }
                }
                ch[i]=a;
                l++;
                num[l]=count;count=0;
            }
        }l+=l;
        for (int i=0;i<sbf.length()-1;i++){
            for (l=i+1;l<sbf.length()-1-i; i++){
                if(num[i]<num[l]){
                    int temp;
                    temp=num[i];
                    num[i]=num[l];
                    num[l]=temp;
                    code=arr[i];
                    arr[i]=arr[l];
                    arr[l]=code;
                }
        }
    }
        for (int i = 0; i <l; i++) {
            System.out.print(arr[i]+",");
            System.out.println(num[i]);
        }
}
}